home *** CD-ROM | disk | FTP | other *** search
/ Euroscene 2 / Euroscene 2.iso / USEFUL / DeliTracker130 / Developer / Developer.run / Examples / FTM / FTM.s next >
Encoding:
Text File  |  1992-09-23  |  3.7 KB  |  178 lines

  1.     opt l+,o-,d-
  2.  
  3.     incdir    "Includes:"
  4.     include    "misc/DeliPlayer.i"
  5.  
  6.  
  7. * Die PlayFTM-Routinen:
  8. * Sie werden über eine Sprungtabelle am Anfang von PlayFTM aufgerufen
  9. * (siehe Handbuch). Keine Routine verändert die Register D2-D7 und A2-A6.
  10. * Eingabeparameter werden je nachdem in den Registern D0...D7 übergeben.
  11. * Rückgabewerte erscheinen in D0.
  12.  
  13. * Hier die Offset-Tabelle für Assembler:
  14.  
  15. StartUp        equ    0    ;Diese Routine ist für uns tabu!
  16.  
  17. InitSound    equ    4
  18. RestoreSound    equ    8
  19. LoadModule    equ    12
  20. FreeModule    equ    16
  21. StartPlay    equ    20
  22. StopPlay    equ    24
  23. SetSpeed    equ    28
  24. SetVolume    equ    32
  25. GetPitch    equ    36
  26. GetAmplitude    equ    40
  27. WaitSongOver    equ    44    ;Im Handbuch nicht beschrieben, siehe unten!
  28. AskSongOver    equ    48    ;Im Handbuch nicht beschrieben, siehe unten!
  29.  
  30. CallStack    equ    52    ;Diese Routine braucht man nur bei BASIC/C
  31.  
  32.  
  33. ;
  34. ;
  35.     SECTION Player,Code
  36. ;
  37. ;
  38.  
  39.     PLAYERHEADER PlayerTagArray
  40.  
  41.     dc.b '$VER: Face The Music player module V1.0 (30 Mar 92)',0
  42.     even
  43.  
  44. PlayerTagArray
  45.     dc.l    DTP_PlayerVersion,0
  46.     dc.l    DTP_PlayerName,PName
  47.     dc.l    DTP_Creator,CName
  48.     dc.l    DTP_Check1,Chk
  49.     dc.l    DTP_InitPlayer,InitPlay
  50.     dc.l    DTP_EndPlayer,EndPlay
  51.     dc.l    DTP_StartInt,StartSnd
  52.     dc.l    DTP_StopInt,StopSnd
  53.     dc.l    DTP_Volume,SetVol
  54.     dc.l    TAG_DONE
  55.  
  56. *-----------------------------------------------------------------------*
  57. ;
  58. ; Player/Creatorname und lokale Daten
  59.  
  60. PName    dc.b 'FaceTheMusic',0
  61. CName    dc.b 'J. Schmidt, © 1991 MAXON,',10
  62.     dc.b 'adapted by Delirium',0
  63.     even
  64.  
  65. _PlayFTM    dc.l PlayFTM            ; Pointer auf FTM-Replay
  66.  
  67. *-----------------------------------------------------------------------*
  68. ;
  69. ; Testet auf Modul
  70.  
  71. Chk                        ; FaceTheMusic ?
  72.     move.l    dtg_ChkData(a5),a0
  73.     moveq    #0,d0
  74.     move.l    (a0),d1
  75.     lsr.l    #8,d1
  76.     cmpi.l    #"FTM",d1
  77.     sne    d0
  78.     rts
  79.  
  80. *-----------------------------------------------------------------------*
  81. ;
  82. ; Init Player
  83.  
  84. InitPlay
  85.     move.l    a5,-(sp)
  86.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  87.     jsr    InitSound(a5)
  88.     move.l    (sp)+,a5
  89.     tst.l    d0                ; SignalBit-Nummer testen
  90.     bmi.s    InitPlayEnd            ; InitSound scheiterte
  91.  
  92.     move.l    dtg_PathArrayPtr(a5),d0        ; ^Filename (already set by DeliTracker)
  93.     move.l    a5,-(sp)
  94.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  95.     jsr    LoadModule(a5)
  96.     move.l    (sp)+,a5
  97.     tst.l    d0                ; Erfolgreich geladen?
  98.     beq.s    InitPlayErr            ; Nein
  99.     moveq    #0,d0                ; no Error
  100.     rts
  101.  
  102. InitPlayErr
  103.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  104.     jsr    RestoreSound(a5)
  105. InitPlayEnd
  106.     moveq    #-1,d0                ; Error
  107.     rts
  108.  
  109. *-----------------------------------------------------------------------*
  110. ;
  111. ; End Player
  112.  
  113. EndPlay
  114.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  115.     jsr    FreeModule(a5)
  116.  
  117.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  118.     jsr    RestoreSound(a5)
  119.     rts
  120.  
  121. *-----------------------------------------------------------------------*
  122. ;
  123. ; Start Song
  124.  
  125. StartSnd
  126.     moveq    #0,d0                ; Endlosschleife
  127.     moveq    #0,d1                ; Starten bei Takt 0
  128.     moveq    #0,d2                ; Spielen bis Song-Ende
  129.     moveq    #0,d3                ; bis Stromausfall
  130.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  131.     jsr    StartPlay(a5)
  132.     rts
  133.  
  134. *-----------------------------------------------------------------------*
  135. ;
  136. ; Stop Song
  137.  
  138. StopSnd
  139.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  140.     jsr    StopPlay(a5)
  141.     rts
  142.  
  143. *-----------------------------------------------------------------------*
  144. ;
  145. ; Set Volume
  146.  
  147. SetVol
  148.     moveq    #0,d0
  149.     move.w    dtg_SndVol(a5),d0
  150.     cmpi.w    #64,d0
  151.     blt.s    SetVolOk
  152.     moveq    #63,d0                ; FTM wants volume only from 0 to 63
  153. SetVolOk
  154.     move.l    _PlayFTM(pc),a5            ; PlayerBase
  155.     jsr    SetVolume(a5)
  156.     rts
  157.  
  158. *-----------------------------------------------------------------------*
  159. ;
  160. ; FaceTheMusic
  161.  
  162. ;
  163. ;
  164.     SECTION Replay,Code            ; PseudoHunk zum Linken
  165. ;
  166. ;
  167.  
  168. PlayFTM
  169.     dc.l 0
  170.  
  171. ;    Cause the file 'PlayFTM' is a executable, you must patch the
  172. ;    resulting file after linking. Find the first Reloc32 Hunk
  173. ;    ($000003EC), approximate offset is $1C0 bytes. Then search
  174. ;    the byte sequence $00,$00,$00,$01, $00,$00,$00,$01. Replace
  175. ;    the last $01 byte through $02. That's it !
  176.  
  177.  
  178.